<%@ page import="com.bafa.objects.season.Season" %>
<%@ page import="com.bafa.objects.season.Division" %>
<%@ page import="com.bafa.objects.team.Team" %>
<%@ page import="com.bafa.objects.team.TeamSeasonStats" %>
<%@ page import="com.bafa.objects.team.TeamStats" %>
<%@ page import="com.bafa.objects.player.*" %>
<%@ page import="com.bafa.objects.*" %>
<%@ page import="com.bafa.middle.*" %>
<%@ page import="com.bafa.front.presentationbeans.*" %>
<%@ page import="java.util.*" %>
<% MatchBean match = (MatchBean)request.getAttribute("MATCH");   %>
<% PlayerListBean players = (PlayerListBean)request.getAttribute("PLAYERS"); %>
<% SeasonBean season = (SeasonBean)session.getAttribute("THISSEASON");   
if(season==null){season = (SeasonBean)request.getAttribute("CURRENTSEASON");}  %>
<% User user = (User)session.getAttribute("LOGGEDON"); %>
<% TeamBean team = (TeamBean)session.getAttribute("LOGGEDONTEAM"); %>
<% LeagueBean division = (LeagueBean)session.getAttribute("DIVISION");%>
<%SiteBean siteBean = (SiteBean)session.getAttribute("SITEBEAN");%>
<style type="text/css">
<!--
#Main {
	position:absolute;
	width:701px;
	height:551px;
	z-index:1;
}

-->
</style>
<script language="JavaScript" type="text/javascript" src="wysiwyg.js"></script>
<script  src="script/niftycube.js" type="text/javascript" ></script>
	<script>
	NiftyLoad=function(){
	     

Nifty("ul#teamstandings h3","top");
Nifty("ul#teamstandings div","bottom same-height");
Nifty("ul#scorers h3","top");
Nifty("ul#scorers div","bottom same-height");
Nifty("ul#alltimescorers h3","top");
Nifty("ul#alltimescorers div","bottom same-height");

Nifty("ul#report h3","top");
Nifty("ul#report div","bottom same-height");
}
</script>
<style type="text/css">
	
	
	
	ul#teamstandings,ul#teamstandings li{margin:0;padding:0;list-style:none}
	ul#teamstandings li{float:left;width:250px;margin:0 10px 10px 0}
	ul#teamstandings h3{font: bold  Verdana,sans-serif; text-transform:uppercase;margin:0px;padding: 5px 0 3px;text-align:center}
	ul#teamstandings p{margin:0;padding:5px 8px 15px}
	ul#teamstandings div{background:#FFFFFF}
	li#teamstandings div{border:2px solid #990000}
	
	ul#alltimescorers,ul#alltimescorers li{margin:0;padding:0;list-style:none}
	ul#alltimescorers li{float:left;width:180px;margin:0 10px 10px 0}
	ul#alltimescorers h3{font: bold  Verdana,sans-serif; text-transform:uppercase;margin:0px;padding: 5px 0 3px;text-align:center}
	ul#alltimescorers p{margin:0;padding:5px 8px 15px}
	ul#alltimescorers div{background:#FFFFFF}
	li#alltimescorers div{border:2px solid #990000}
	
	ul#report,ul#report li{margin:0;padding:0;list-style:none}
	ul#report li{float:left;width:455px;margin:0 10px 10px 0}
	ul#report h3{font: bold  Verdana,sans-serif; text-transform:uppercase;margin:0px;padding: 5px 0 3px;text-align:center}
	ul#report p{margin:0;padding:5px 8px 15px}
	ul#report div{background:#FFFFFF}
	li#report div{border:2px solid #D2D2D2}
	
	
</style>


 <script type='text/javascript' src='dwr/interface/JDate.js'></script>
 <script type='text/javascript' src='dwr/interface/ajax.js'></script>
  <script type='text/javascript' src='dwr/engine.js'></script>
  <script type='text/javascript' src='dwr/util.js'></script>
  <script>
  function update() {
    var name = dwr.util.getValue("subdomainid");
    ajax.checkDomain(name, function(data) {
      dwr.util.setValue("subdomainreply", data);
    });
}


</script>
 <script>
 
 
 
  function autocomplete(e) {
 var code;
 if (e.keyCode) code = e.keyCode;
 else if (e.which) code = e.which;
  if(code != 8 && code != 37 && code != 39){
    var name = dwr.util.getValue("addscorer");
    if(name!=""){
    origtext = name;
    ajax.getScorerName(name, function(data) {
    if(data!=""){
      dwr.util.setValue("addscorer", data);
      dwr.util.selectRange("addscorer",name.length,data.length);
      }
    });
    }
    }
}

function highlight(data){
var name = dwr.util.getValue("addscorer");
dwr.util.selectRange("addscorer",0,data.length);
}

</script>


<script language="javascript">
var addedscorers = new Array();


var existingscorers = new Array();
<%if(players.players()!=null){
for(int i=0;i<players.players().length;i++){%>
existingscorers[<%=i%>] = "<%=players.players()[i].getName()%>";
<%}%>

<%}%>

var i = 1;
var x = 0;




function confirmScorer(name,goals){
	var text = "goals";
	if(goals<2)
		text="goal";
		
	document.getElementById('existingscorertable').innerHTML +='<b><input type="hidden" name="scorer'+i+'" value="'+name+'"/>'+name+' </b>';
	document.getElementById('existingscorertable').innerHTML +='<b><input type="hidden" name="scoredgoals'+i+'" value="'+goals+'" /> - '+goals+' '+text+'</b><br/>';
	
i++;
x=x+20;
}



</script>











<div >
<form method="post"  name="resultform" action="addresult.bafa">
<input type="hidden" name="teamId" value="<%=user.getTeamId()%>"/>
<input type="hidden" name="teamAId" value="<%=match.getTeamA()%>"/>
<input type="hidden" name="teamBId" value="<%=match.getTeamB()%>"/>
<input type="hidden" name="matchId" value="<%=match.getID()%>"/>
<input type="hidden" name="userId" value="<%=user.getUserId()%>"/>
<input type="hidden" name="divisionId" value="<%=match.getDivisionId()%>"/>
<input type="hidden" name="seasonId" value="<%=season.getId()%>"/>
   
   <ul id="report"><li id="report"><h3 class="avlh">Score and Match Report (optional) </h3>
   
   <div class="sad">
  <br/>
  
  <b><%=match.getTeamAName()%></b> <input type="text" id="checkgoalsA" name="goalsA" size=2/> <input type="text" id="checkGoalsB" name="goalsB" size=2/> <b><%=match.getTeamBName()%></b>
      <br/>
      <br/>
  <input type="text" id="addscorer" name="newsc0rer" onFocus="javascript:highlight(this.value)" onkeyup="javascript:autocomplete(event)"/> <input type="text" size="2" name="newsc0rergoals" /> <a href="javascript:confirmScorer(document.resultform.newsc0rer.value,document.resultform.newsc0rergoals.value)"><b>Confirm scorer</b></a>
 <br/>
 <br/>
  <span id="existingscorertable"><u><strong>Scorers</strong></u><br/></span>
  <br/>
<br/>
Add a Match Report: <input type="checkbox" name="addreport" value="addreport">
<br/>
<br/>
     <input type="text" name="author" onFocus="javascript:this.value=''" value="Author"/> <input type="text" onFocus="javascript:this.value=''" name="title" value="Headline" size="45"/>
    <br/>
      <textarea id="textarea1" name="report" style="height: 400px; width: 450px;"></textarea>
      <script language="javascript1.2">
        generate_wysiwyg('textarea1','');
      </script>
  
  <br/><br/>
  <span id="existingscorertable"><u><strong>Scorers</strong></u><br/></span>
  <br/>
  <br/>
  <input class='leftbutton' type='submit' name='submit' value='Submit' />
  <br/>
  <br/>
</div>
  </li>
  </ul>
  </form>
</div>
  

